export default {
    transToTableData(data,strId) {
        if (data.length === 0) {
            return {};
        }
        //data是对象数组
        const result = {};
        const keys = Object.keys(data[0]);
        //保存表头
        result.tableHead = keys;
        const arr = [];
        for (const datum of data) {
            const tmp_arr = [];
            for (const key of keys) {
                tmp_arr.push(datum[key]);
            }
            const obj = {};
            obj.data = tmp_arr;
            obj.id = datum[strId];
            arr.push(obj);
        }
        //保存数据
        result.tableData = arr;
        return result;
    }
}

